<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">

        <title>粉粉管理系统</title>

        <!-- Bootstrap core CSS -->
        <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
        <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">

        <!--Animation css-->
        <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">

        <!--Icon-fonts css-->
        <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
        <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />
        
        <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">
        
        <!-- Plugins css -->
        <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">

        <!-- DataTables -->
        <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />

        <!-- Custom styles for this template -->
        <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
        <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">
        
        <!-- My styles for this template -->
        <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet">

    </head>

    <body>

        <!-- Aside Start-->
        <!--{template admin_v2/leftside}-->
        <!-- Aside Ends-->


        <!--Main Content Start -->
        <section class="content">
            
            <!-- Header -->
            <!--{template admin_v2/header}-->
            <!-- Header Ends -->


            <!-- Page Content Start -->
            <!-- ================== -->

            <div class="wraper container-fluid diary-topics">
            
            	<div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">女生认证列表</h3>
                            </div>
                            <div class="panel-body">
                            	<div class="row">
                            		<div class="col-md-6 col-sm-6 col-xs-6">
		                                   <form class="form-inline" role="form" action="admin.php" method="get" >
		                                    <div class="form-group">
		                                        	共<span class="label label-success"><!--{$allNum}--></span>条,跳转到<input type="text" class="form-control" style="width:50px;"  name="page">页,当前第<span class="label label-primary"><!--{$currentPage}--></span>页
		                                    </div>
		                                    <input type="hidden" value="getFemaleAuthList" name="op">
		                                    <input type="hidden" value="femaleAuth_class" name="ac">
		                                    <button type="submit" class="btn btn-primary m-l-10">开始跳转</button>
		                                </form>
		                            </div>
                                	<div class="col-md-6 col-sm-6 col-xs-6">
	                                	<!-- Search -->
									    <form class="form-inline" role="form" action="admin.php?ac=femaleAuth_class&op=getUserFemaleAuthInfo" method="post" style="float:right;">
		                                    <div class="form-group">
		                                        <input type="text" class="form-control"  placeholder="输入UID" name="uuid">
		                                    </div>
		                                    <button type="submit" class="btn btn-success m-l-10">点击搜索</button>
		                                </form>
		                            </div>
                            	</div>
                            	<br/>
                                <div class="row">
                                    <div class="col-md-12 col-sm-12 col-xs-12">
                                        <table id="datatable" class="table table-striped table-bordered">
                                            <thead>
                                                <tr>
													<th style="width:10%" >
														<div class="btn-group" style="margin-bottom: 5px;">
															<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
																批量操作 <span class="caret"></span>
															</button>
															<ul class="dropdown-menu">
																<li><a href="#" class='batchAction'  data-status='0'>添加认证</a></li>
																<li><a href="#" class='batchAction' data-status='4'>忽略认证</a></li>
																<li><a href="#" class='batchAction' data-status='2'>拉黑认证</a></li>
															</ul>
														</div>
														<label class="cr-styled">
															<input type="checkbox" id="batchAll">
															<i class="fa"></i>
															全选
														</label>
													</th>
                                                    <th>UID</th>
				                                    <th>昵称</th>
				                                    <th>音频</th>
													<th>操作</th>
				                                    <th>等级</th>
				                                    <th>状态</th>
				                                    <th>申请时间</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                            	<!--{loop $list $value}-->
                                                <tr id="tr_{$value['uid']}">
													<td>
														<label class="cr-styled">
															<input type="checkbox" class="batch" data-uid="{$value[uid]}">
															<i class="fa"></i>
														</label>
													</td>
                                                    <td>{$value['uid']}</td>
				                                    <td><a href="admin.php?ac=admin&do=accountOperation&uid={$value[uid]}" class="btn btn-primary btn-xs m-b-5 topic-name" target="_blank"><!--{$value[user][nickname]}--></a></td>
				                                    <td>
				                                    	<audio style="border-radius:50px;width:80px;" preload="auto" controls >
															<source src="{$value['auth_url']}" />
														</audio>
				                                    </td>
													<td>
														<div class="btn-group ">
															<button class="btn btn-success">管理</button>
															<button class="btn  btn-success dropdown-toggle" data-toggle="dropdown">
																<span class="caret"></span>
															</button>
															<ul class="dropdown-menu">
																<li><a href="javascript:void(0);" class="permit" data-bodyuid="{$value['uid']}" name=0 >添加认证</a></li>
																<li><a href="javascript:void(0);" class="reapply" data-bodyuid="{$value['uid']}">忽略认证</a></li>
																<li><a href="javascript:void(0);" class="permit" data-bodyuid="{$value['uid']}" name=2 >拉黑认证</a></li>
															</ul>
														</div>
													</td>
				                                    <td>
				                                    	<!--{$value['user']['level']}-->
				                                    </td>
				                                    <td>
				                                    	<!--{eval interpretationState($value['status'])}-->
				                                    </td>
				                                    <td>
				                                    	<!--{date('y/m/d H:i',$value['applytime'])}-->
				                                    </td>

                                                </tr>
                                                <!--{/loop}-->
                                             </tbody>
                                         </table>
                                         <!--{if $pageUrl}-->
		                                 <ul class="pager"> 
		                                    <li> 
		                                        <a href="{$pageUrl['prev']}"> <i class="fa fa-angle-double-left"></i>上一页</a> 
		                                    </li> 
		                                    <li> 
		                                        <a href="{$pageUrl['first']}"> <i class="fa"></i>第一页</a> 
		                                    </li> 
		                                    <li> 
		                                        <a href="{$pageUrl['next']}">下一页 <i class="fa fa-angle-double-right"></i> </a> 
		                                    </li> 
		                                 </ul>
		                                 <!--{/if}--> 
                                     </div>
                                 </div>
                             </div>
                         </div>
                     </div>
                 </div>

            </div>
            <!-- Page Content Ends -->
            <!-- ================== -->
              
            <!-- Footer Start -->
            <!--{template admin_v2/footer}-->
            <!-- Footer Ends -->



        </section>
        <!-- Main Content Ends -->


        <!-- js placed at the end of the document so the pages load faster -->
        <script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

		<script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>
		<script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>

        <script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>
        
        <!-- Modal-Effect -->
        <script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>
        
		<script type="text/javascript">
			$(document).on('click','#batchAll',function(){
				var s = false;
				if($(this).is(':checked')){
					$( "input[class=batch]" ).each(function() {
						$(this).prop('checked',true);
					});
				}else{
					$( "input[class=batch]" ).each(function() {
						$(this).removeAttr('checked');
					});
				}
			});

			$(document).on('click','.batchAction',function () {
				var index = layer.load(2,{shade: [0.8, '#393D49']});
				var sta = $(this).data('status');
				var res = 1;
				var url = "admin.php?ac=femaleAuth_class&op=permit";
				$("input[class=batch]:checked").each(function() {
					var uuid = $(this).data('uid');
					var data = {'status':sta,'uuid':uuid};
					if(sta == "4"){
						data = {'uuid':uuid};
						url  = "admin.php?ac=femaleAuth_class&op=reapply";
					}
					console.log(data);
					$.ajax(
							{
								url     :   url,
								type    :   "GET",
								data    :   data,
								async 	: false,
								success :   function(data)
								{
									console.log(data);
									if(data == "true" || data==1){
									}else{
										res = 0;
									}
								}
							});

				});

				setTimeout(function(){
					if(res){
						swal("操作成功!", "操作成功！", "success");
					}else{
						swal("操作失败!", "操作(有部分)失败！", "error");
					}
					layer.close(index);
					window.location.reload();
				},1000);

			});

		   $(document).on('click','.permit',function(){				
				status=$(this).attr('name');	
				var data=$(this).data();
				var tritem="tr_"+data.bodyuid;
				var uuid=data.bodyuid;	
				var title = '';
				if(status == 2){
					 title = '拉黑';
				}else{
					 title = '通过';
				}
				
				swal(
                		{   
	                		title: "确定"+title+"?",
	                		text: "请慎重操作!",
	                		type: "warning",   
	                		showCancelButton: true,   
	                		confirmButtonColor: "#DD6B55",   
	                		confirmButtonText: "Sure!",   
	                		closeOnConfirm: false 
                		}, 
                		function(){
                			$.ajax(
                		            {
                		                url     :   "admin.php?ac=femaleAuth_class&op=permit",
                		                type    :   "GET",
                		                data    :   {'status':status,'uuid':uuid},
                		                success :   function(data)
                		                            {
                		                				if(data=="true"){
                		                					$('#'+tritem).fadeOut('normal');
                		                					swal("操作完成!", "", "success");
                		                				}else{
                		                					swal("操作失败!", "", "error"); 
                		                				}
                		                				refresh();
                		                            }
                		            });
                		});
		});
	    $(document).on('click','.reapply',function(){	
	    	var data=$(this).data();
			var tritem="tr_"+data.bodyuid;
			var uuid=data.bodyuid;		
			swal(
               		{   
                		title: "不通过女生认证?",
                		text: "请慎重操作!",
                		type: "warning",   
                		showCancelButton: true,   
                		confirmButtonColor: "#DD6B55",   
                		confirmButtonText: "Sure!",   
                		closeOnConfirm: false 
               		}, 
               		function(){
               			$.ajax(
               		            {
               		                url     :   "admin.php?ac=femaleAuth_class&op=reapply",
               		                type    :   "GET",
               		                data    :   {'uuid':uuid},
               		                success :   function(data)
               		                            {
               		                				if(data==1){
               		                					$('#'+tritem).fadeOut('normal');
               		                					swal("操作完成!", "", "success");
               		                				}else{
               		                					swal("操作失败!", "", "error"); 
               		                				}
               		                				refresh();
               		                            }
               		            });
               		});
		})  
		// 刷新当前页面
    	function refresh(){
    		setInterval(window.location.reload(),1000);
    	}
        </script>
    </body>
</html>
